package primetest.faces;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;


import primetest.dto.DoctorDto;

public class DoctorListModel extends ListDataModel<DoctorDto> implements SelectableDataModel<DoctorDto> {

	public DoctorListModel(List<DoctorDto> bookList){
		super(bookList);
	}

	@Override
	public DoctorDto getRowData(String rowKey) {
		int bookSeq = Integer.valueOf(rowKey);
		@SuppressWarnings("unchecked")
		List<DoctorDto> bookList = (List<DoctorDto>)getWrappedData();
		for (DoctorDto bookDto : bookList) {
			if(bookDto.getSeq() == bookSeq){
				return bookDto;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(DoctorDto bookDto) {
		return bookDto.getSeq();
	}

}
